<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<HTML DIR="LTR">
	<HEAD>
		<TITLE>HarePoint Explorer for SharePoint - Example of work with Windows Forms</TITLE>
		<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=Windows-1252">
		<META NAME="Product" CONTENT="HarePoint Explorer for SharePoint">
		<META NAME="CHARSET" CONTENT="iso-8859-1">
		<META NAME="KEYWORDS" CONTENT="">
		<LINK REL="stylesheet" MEDIA="SCREEN" TYPE="text/css" HREF="../css/mailto_exchange.css">
			<LINK REL="stylesheet" TYPE="text/css" HREF="../css/coUA_Ex.css">
				<LINK REL="stylesheet" TYPE="text/css" HREF="../css/coUA.css">
					<LINK REL="stylesheet" MEDIA="PRINT" TYPE="text/css" HREF="../css/CoUA_Print.css">
						<SCRIPT LANGUAGE="JScript" SRC="../scr/shared.js"></SCRIPT>
						<SCRIPT LANGUAGE="javascript" SRC="../scr/mailto.en.js"></SCRIPT>
	</HEAD>
	<BODY>
		<DIV CLASS="titleNodeLevel1">HarePoint Explorer for SharePoint - Example of work with Windows Forms</DIV>
		<DIV CLASS="titleNodeLevel2">&nbsp;</DIV>
		<H1>Example of work with Windows Forms</H1>

<p>As another example of universality of HarePoint Explorer for SharePoint, let`s review the operations with class <b>System.Windows.Forms.Form</b>.</p>

<p>Open new script window and modify text of method <b>main</b> the following way:</p>

<p><div class="code1"><pre>
<b>C#</b>

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using MAPILab.SharePoint.Explorer.CodeForm;
using MAPILab.SharePoint.Explorer.Utilities.ScriptRunner;
using System.Windows.Forms;

public class Tester
{
    static void Main(
         MAPILab.SharePoint.Explorer.CodeForm.MLCodeForm thisForm
        ,MAPILab.SharePoint.Explorer.Utilities.ScriptRunner.MLBrowser browser
        )
    {
        
        Form form = new Form(); 
        form.Text = "Hello From HarePoint Explorer for SharePoint"; 
        FlowLayoutPanel layoutPanel = new FlowLayoutPanel(); 
        form.Controls.Add(layoutPanel); 
        layoutPanel.Dock = DockStyle.Fill; 
        TextBox textBox = new TextBox(); 
        textBox.Text = "Enter you name"; 
        layoutPanel.Controls.Add(textBox); 
        Button button = new Button(); 
        button.Text = "Click Me!"; 
        layoutPanel.Controls.Add(button); 
        form.Show();

        // Output browser configuration
        //browser.Text = "Browser window";
        //browser.DisplayMode = MAPILab.SharePoint.Explorer.Utilities.ScriptRunner.DisplayMode.Expanded;
        browser.ReturnValue = form;
    }
}

</pre></div></p>

<p><div class="code1"><pre>
<b>Visual Basic</b>

Imports System
Imports System.Collections.Generic
Imports System.Diagnostics
Imports System.Text
Imports MAPILab.SharePoint.Explorer.CodeForm
Imports MAPILab.SharePoint.Explorer.Utilities.ScriptRunner
Imports System.Windows.Forms

Public Class Tester
    Shared Sub Main(ByVal thisForm As MAPILab.SharePoint.Explorer.CodeForm.MLCodeForm, 
                    ByVal browser As MAPILab.SharePoint.Explorer.Utilities.ScriptRunner.MLBrowser)
        
        Dim form As Form = new Form()
        form.Text = "Hello From HarePoint Explorer for SharePoint"
        Dim layoutPanel As FlowLayoutPanel = new FlowLayoutPanel() 
        form.Controls.Add(layoutPanel)
        layoutPanel.Dock = DockStyle.Fill
        Dim textBox As TextBox = new TextBox()
        textBox.Text = "Enter you name"
        layoutPanel.Controls.Add(textBox)
        Dim button As Button = new Button()
        button.Text = "Click Me!"
        layoutPanel.Controls.Add(button)
        form.Show()
        
        ' Output browser configuration
        'browser.Text = "Browser window"
        'browser.DisplayMode = MAPILab.SharePoint.Explorer.Utilities.ScriptRunner.DisplayMode.Expanded

        browser.ReturnValue = form
    End Sub
End Class
</pre></div></p>

<p>The given program code creates new window, adds several controls in it, after that it is displayed using method <b>Show()</b> and returns reference to window object for further investigation. The result of script execution looks the following way:</p>

<p><A ID="ExPand" href="#">Show screenshot</A><div class="expand3"><center>
<img src="../imgs/image033.png">
</center></div></p>

<p>Here, pay attention that properties of created window may be changed. By changing properties (without closing anything), our window can be made to look the following way:</p>

<p><A ID="ExPand" href="#">Show screenshot</A><div class="expand3"><center>
<img src="../imgs/image035.png">
</center></div></p>

<SCRIPT LANGUAGE="jscript" SRC="../scr/mkfoot.en.js"></SCRIPT>
</BODY>
</HTML>